#ifndef OPTION
#	define OPTION

#include "../../include/config.h"

#include <boost/program_options.hpp>
#include <iostream>
#include <fstream>
#include <iterator>



namespace HappyDB
{
namespace Common 
{

using namespace std;

// A helper function to simplify the main part.
template<class T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    copy(v.begin(), v.end(), ostream_iterator<T>(cout, " ")); 
    return os;
}

struct settings {
    size_t item_buf_size;
    int maxconns;
    int port;
    int udpport;
    string inter;
    int verbose;
    string socketpath;   /* path to unix socket if using local socket */
    int access;  /* access mask (a la chmod) for unix domain socket */
    int num_threads;        /* number of libevent threads to run */
};


namespace po = boost::program_options;
class CHappyEngineOption 
{
public:
	CHappyEngineOption();
	~CHappyEngineOption();

public:
	po::options_description			m_all;
	po::options_description			m_commandLine;
	po::options_description			m_commandLineBDB;
	po::options_description			m_configFile;
	po::variables_map				m_vm;


	// 
	settings						m_settings;

public:
	int init(int ac, char *av[]);
	void print_license();

	int GetValueInt(string s);
	string GetValueString(string s);
	bool GetIsset(string s);
};



	}
}



#endif


